﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using CrystalDecisions.Shared;
namespace QUANLYDIEMHOCSINH
{
    public partial class frmThongKeTheoKhoi : Form
    {
        DIEMBUS diembus = new DIEMBUS();
        public frmThongKeTheoKhoi()
        {
            InitializeComponent();
        }
        public string NamHoc { get; set; }
        public int MaNam { get; set; }
        public string HocKy { get; set; }
        public string Mon { get; set; }
        public int MaHocKy { get; set; }
        public int MaMon { get; set; }
        public int MaKhoi { get; set; }
        private void frmThongKeTheoKhoi_Load(object sender, EventArgs e)
        {
            DataTable dts = new DataTable();
            dts = diembus.LoadDiemTheoLopTheoKhoi(MaKhoi, MaHocKy, MaMon, MaNam);

            crpThongKeTheoKhoi objRpt = new crpThongKeTheoKhoi();
            objRpt.SetDataSource(dts);
            rpThongKeTheoKhoi.ReportSource = objRpt;
            rpThongKeTheoKhoi.Refresh();


            //truyền tham số cho report
            ParameterFields crtParamFields = new ParameterFields();
            ParameterDiscreteValue nh = new ParameterDiscreteValue();
            nh.Value = NamHoc;
            ParameterField nam = new ParameterField();
            nam.ParameterFieldName = "txtNamHoc";
            nam.CurrentValues.Add(nh);
            crtParamFields.Add(nam);

            ParameterDiscreteValue hk = new ParameterDiscreteValue();
            hk.Value = HocKy;
            ParameterField hocky = new ParameterField();
            hocky.ParameterFieldName = "txtHocKy";
            hocky.CurrentValues.Add(hk);
            crtParamFields.Add(hocky);

            ParameterDiscreteValue m = new ParameterDiscreteValue();
            m.Value = Mon;
            ParameterField mon = new ParameterField();
            mon.ParameterFieldName = "txtMon";
            mon.CurrentValues.Add(m);
            crtParamFields.Add(mon);

            rpThongKeTheoKhoi.ParameterFieldInfo = crtParamFields;
        }
    }
}
